#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, char* argv[])
{
    //for(int i = 0 ; i < argc; i++)//这样也行
    //    printf("argv[i]=%s\n", argv[i]);
    for(int i = 0; argv[i]; i++)
        printf("argv[%d]=%s\n", i, argv[i]);
    if(argc != 4)
        printf("Error\n");
    else
    {
        int num1 = atoi(argv[2]), num2 = atoi(argv[3]);
        if(!strcmp(argv[1], "add"))
            printf("%d+%d=%d\n",num1, num2, num1 + num2);
        if(!strcmp(argv[1], "sub"))
            printf("%d-%d=%d\n",num1, num2, num1 - num2);
        if(!strcmp(argv[1], "mul"))
            printf("%d*%d=%d\n",num1, num2, num1 * num2);
        if(!strcmp(argv[1], "div") && num2)
            printf("%d/%d=%d\n",num1, num2, num1 / num2);
    }
    return 0;
}
